26. Exercise: Edit Text Preference

Exercise Code

In this exercise, you will get to add a new preference that will accept a numerical value from the user and use that as a size multiplier to scale the shapes in our Visualizer app.

Exercise: T06.09-Exercise-EditTextPreference

Edit Text Preference

Now it's your turn to create the last preference of type Edit Text to set the shape size multiplier

SOLUTION:
  • Add and EditTextPreference using the appropriate string recourses
  • Modify the setupSharedPreferences method to use the new preference value rather than hard coded 1
  • Modify onSharedPreferencesChanged to parse the preference value and set the correct shape size